package leecode

func minCostClimbingStairsLCR(cost []int) int {
	dp := make([]int, len(cost)+1)
	dp[0], dp[1] = 0, 0 //到达第0阶 和 第1阶的最小花费是0
	for i := 2; i < len(cost); i++ {
		dp[i] = min(dp[i-1]+cost[i-1], dp[i-2]+cost[i-2])
	}
	return dp[len(dp)-1]
}
